/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Pembelian;

//import Barang.*;
import Koneksi.koneksi;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author mitul
 */
public class tabelPembelianModel extends AbstractTableModel {

    private List<pembelian> beli= new ArrayList<pembelian>();
    public tabelPembelianModel(List<pembelian> beli) {
        this.beli = beli;
    }

    public int getRowCount() {
        return beli.size();
    }

    public int getColumnCount() {
        return 2;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        pembelian k = beli.get(rowIndex);

        switch (columnIndex) {
            case 0:
                return k.getNo_transaksibeli();
            case 1:
                return k.getWaktu().substring(0, 10);
            default:
                return "";
        }

    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return " Nomor Pembelian";
            case 1:
                return "Tanggal Pembelian";     
            default:
                return "";

        }
    }

      
}

